<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateInternalMessageEntityTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateInternalMessageEntityLabel_sender}" for="sender" />
                    <h:selectOneMenu id="sender" value="#{internalMessageEntityController.selected.sender}" title="#{bundle.CreateInternalMessageEntityTitle_sender}" >
                        <f:selectItems value="#{systemUserEntityController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.CreateInternalMessageEntityLabel_recipients}" for="recipients" />
                    <h:selectManyMenu id="recipients" value="#{internalMessageEntityController.selected.recipients}" title="#{bundle.CreateInternalMessageEntityTitle_recipients}" converter="systemUserConverter" >
                        <f:selectItems value="#{systemUserEntityController.itemsAvailableSelectMany}"/>      
                    </h:selectManyMenu>
                    
                    <h:outputLabel value="#{bundle.CreateInternalMessageEntityLabel_recipients}" for="departmentRecipients" />
                    <h:selectManyMenu id="departmentRecipients" value="#{internalMessageEntityController.selected.departmentRecipients}" title="#{bundle.CreateInternalMessageEntityTitle_recipients}" converter="departmentConverter" >
                        <f:selectItems value="#{departmentEntityController.itemsAvailableSelectMany}"/>      
                    </h:selectManyMenu>
                    
                    <h:outputLabel value="#{bundle.CreateInternalMessageEntityLabel_title}" for="title" />
                    <h:inputText id="title" value="#{internalMessageEntityController.selected.title}" title="#{bundle.CreateInternalMessageEntityTitle_title}" />
                    <h:outputLabel value="#{bundle.CreateInternalMessageEntityLabel_body}" for="body" />
                    <h:inputTextarea id="body" value="#{internalMessageEntityController.selected.body}" title="#{bundle.CreateInternalMessageEntityTitle_body}" />                
                    
                    <h:outputLabel value="#{bundle.CreateInternalMessageEntityLabel_messageType}" for="messageType" />
                    <h:selectOneMenu id="messageType" value="#{internalMessageEntityController.selected.messageType}" title="#{bundle.CreateInternalMessageEntityTitle_messageType}" >
                        <f:selectItems value="#{internalMessageEntityController.messageTypes}"/>      
                    </h:selectOneMenu>
                    
                </h:panelGrid>
                <h:commandButton action="#{internalMessageEntityController.createAndSend}" value="#{bundle.EditInternalMessageEntitySaveAndSendLink}"/>
                <h:commandButton action="#{internalMessageEntityController.create}" value="#{bundle.CreateInternalMessageEntitySaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{internalMessageEntityController.prepareList}" value="#{bundle.CreateInternalMessageEntityShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.CreateInternalMessageEntityIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
